package com.yz.food.cms.controller;

import com.github.pagehelper.PageInfo;
import com.yz.food.cms.pojo.Order;
import com.yz.food.cms.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
public class OrderController {
    @Autowired
    private OrderService orderService;

    /**
     * 订单列表
     */
    @RequestMapping("page/order")
    public String orderList(@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
                            @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                            ModelMap modelMap) {
        PageInfo<Order> pageInfo = orderService.getAll(pageNum, pageSize);
        modelMap.addAttribute("pageInfo", pageInfo);
        return "order";
    }
}
